#define DEBUG
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

const int maxr=300, maxs=300, sqrtmaxn=1000, mods=1000000007;

int c(int n, int m) {
  static int f[maxr*2+1][maxs*2+1];
  f[0][0] = 1;
  for (int i=1; i<=n; i++) {
    f[i][0] = 1;
    for (int j=1; j<=i; j++) {
      f[i][j] = (f[i-1][j]+f[i-1][j-1])%mods;
    }
  }
  return f[n][m];
}

int main() {
  freopen("mobitel.in","r",stdin);
  freopen("mobitel.out", "w", stdout);
  
  static int a[maxr+1][maxs+1];
  int r, s, n;
  scanf("%d %d %d", &r, &s, &n);
  for (int i=1; i<=r; i++) {
    for (int j=1; j<=s; j++) {
      scanf("%d", &a[i][j]);
    }
  }

  static int f[2][maxs+1][2*sqrtmaxn+1][2];
  f[1][1][0][0] = 1;
  f[1][1][1][1] = 1;
  f[1][1][1][0] = (n-1)/a[1][1];
  for (int i=1; i<=r; i++) {
    int t=i%2;
    for (int j=1; j<=s; j++) {
      if (i==1 && j==1) {
	continue;
      }
      memset(f[t][j], 0, sizeof f[t][j]);
      int nt=(i-1)%2, lim=0;
      for (int x=1, y=1; x<=f[nt][j][0][0] || y<=f[t][j-1][0][0]; ) {
	if (y>f[t][j-1][0][0] || (x<=f[nt][j][0][0] && f[nt][j][x][0]<=f[t][j-1][y][0])) {
	  if (f[nt][j][x][0]/a[i][j]>0) {
	    if (!lim || f[t][j][lim][0]<f[nt][j][x][0]/a[i][j]) {
	      f[t][j][++lim][0] = f[nt][j][x][0]/a[i][j];
	    }
	    f[t][j][lim][1] = (f[t][j][lim][1]+f[nt][j][x][1])%mods;
	  }
	  x++;
	} else {
	  if (f[t][j-1][y][0]/a[i][j]>0) {
	    if (!lim || f[t][j][lim][0]<f[t][j-1][y][0]/a[i][j]) {
	      f[t][j][++lim][0] = f[t][j-1][y][0]/a[i][j];
	    }
	    f[t][j][lim][1] = (f[t][j][lim][1]+f[t][j-1][y][1])%mods;
	  }
	  y++;
	}
      }
      f[t][j][0][0] = lim;
    }
  }

  int t=r%2, ans=0;
  for (int i=1; i<=f[t][s][0][0]; i++) {
    ans = (ans+f[t][s][i][1])%mods;
  }
  printf("%d", (c(r+s-2, r-1)+mods-ans)%mods);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
